var js = 0;

function statChart(id, title) {
	//var id = obj.href.substring(obj.href.indexOf("#") + 1);
	$$('#' + id).html("<div id='main" + id + "' style='width: " + document.body.clientWidth + "px;height:6em;'></div>");
	// 基于准备好的dom，初始化echarts实例
	var myChart1 = echarts.init(document.getElementById("main" + id));
	// 指定图表的配置项和数据
	option1 = {
		title: {
			text: ''
		},
		tooltip: {
			show: false
		},
		legend: {
			show: false
		},
		calculable: true,
		grid: {
			width: '95%',
			height: '85%',
			left: '1%',
			bottom: '3%',
			containLabel: true
		},
		xAxis: [{
			type: 'category',
			boundaryGap: false,
			splitLine: {　　　　
				show: false　　
			},
			axisLine: {
				lineStyle: {
					color: '#ffffff'
				}
			},
			axisTick: {
				lineStyle: {
					color: '#ffffff'
				}
			},
			axisLabel: {
				show: true,
				textStyle: {
					color: '#ffffff'
				}
			},
			data: ['21', '22', '23', '24', '25', '26', '27']
		}],
		yAxis: [{
			show: false,
			splitLine: {　　　　
				show: false　　
			},
			type: 'value'
		}],
		series: [{
			name: title,
			type: 'line',
			stack: '总量',
			itemStyle: {
				normal: {
					color: '#ffffff',
					lineStyle: {
						color: '#ffffff'
					},
					label: {
						show: true
					}
				}
			},
			smooth: true,
			data: [120, 130, 100, 130, 90, 140, 210]
		}]
	};

	// 使用刚指定的配置项和数据显示图表。
	myChart1.setOption(option1);
}

function statChartStatic(id, title) {

	var date_data = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10',
		'11', '12', '13', '14', '15', '16', '17', '18', '19', '20',
		'21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31'
	];
	var kal_data = [98, 97, 99, 98, 96, 95, 97, 99, 100, 98,
		99, 97, 96, 95, 94, 93, 93, 93, 93, 93,
		93, 93, 87, 86, 85, 84, 83, 84, 85, 86,87
	];

	var timeData = [
		'1', '2', '3', '4', '5', '6', '7', '8', '9', '10',
		'11', '12', '13', '14', '15', '16', '17', '18', '19', '20',
		'21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31'
	];

	//var id = obj.href.substring(obj.href.indexOf("#") + 1);
	$$('#' + id).html("<div id='main" + id + "' style='width: " + document.body.clientWidth + "px;height:6em;'></div>");
	// 基于准备好的dom，初始化echarts实例
	var myChart1 = echarts.init(document.getElementById("main" + id));

	option1 = option = {
		tooltip: {
			trigger: 'axis',
			position: function(pt) {
				return [pt[0], '5%'];
			}
		},
		title: {
			left: 'center',
			text: '',
		},
		legend: {
			top: 'bottom',
			data: ['意向']
		},
		xAxis: {
			splitLine: {　　　　
				show: false　　
			},
			axisLine: {
				lineStyle: {
					color: '#ffffff'
				}
			},
			axisTick: {
				lineStyle: {
					color: '#ffffff'
				}
			},
			axisLabel: {
				show: true,
				textStyle: {
					color: '#ffffff'
				}
			},
			type: 'category',
			boundaryGap: false,
			data: date_data
		},
		yAxis: {
			show: false,
			splitLine: {　　　　
				show: false　　
			},
			type: 'value',
			boundaryGap: [0, '100%']
		},
		grid: {
			width: '100%',
			height: '85%',
			left: '-3%',
			bottom: '3%',
			containLabel: true
		},
		series: [{
			name: '腰围',
			type: 'line',
			smooth: true,
			symbol: 'none',
			sampling: 'average',
			itemStyle: {
				normal: {
					color: '#ffffff',
					lineStyle: {
						color: '#ffffff'
					},
					label: {
						show: true
					}
				}
			},
			smooth: true,
			data: kal_data
		}]
	};

	// 使用刚指定的配置项和数据显示图表。
	myChart1.setOption(option1);
}


function statChartHealth(id, title) {

	var date_data = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10',
		'11', '12', '13', '14', '15', '16', '17', '18', '19', '20',
		'21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31'
	];
	var kal_data = [191, 197, 199, 198, 196, 195, 197, 199, 200, 198,
		199, 197, 196, 195, 194, 193, 193, 193, 193, 193,
		193, 193, 187, 186, 185, 184, 183, 184, 185, 186,187
	];

	var timeData = [
		'1', '2', '3', '4', '5', '6', '7', '8', '9', '10',
		'11', '12', '13', '14', '15', '16', '17', '18', '19', '20',
		'21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31'
	];

	//var id = obj.href.substring(obj.href.indexOf("#") + 1);
	$$('#' + id).html("<div id='main" + id + "' style='width: " + document.body.clientWidth + "px;height:6em;'></div>");
	// 基于准备好的dom，初始化echarts实例
	var myChart1 = echarts.init(document.getElementById("main" + id));

	option1 = option = {
		tooltip: {
			trigger: 'axis',
			position: function(pt) {
				return [pt[0], '5%'];
			}
		},
		title: {
			left: 'center',
			text: '',
		},
		legend: {
			top: 'bottom',
			data: ['意向']
		},
		xAxis: {
			splitLine: {　　　　
				show: false　　
			},
			axisLine: {
				lineStyle: {
					color: '#ffffff'
				}
			},
			axisTick: {
				lineStyle: {
					color: '#ffffff'
				}
			},
			axisLabel: {
				show: true,
				textStyle: {
					color: '#ffffff'
				}
			},
			type: 'category',
			boundaryGap: false,
			data: date_data
		},
		yAxis: {
			show: false,
			splitLine: {　　　　
				show: false　　
			},
			type: 'value',
			boundaryGap: [0, '100%']
		},
		grid: {
			width: '100%',
			height: '85%',
			left: '-3%',
			bottom: '3%',
			containLabel: true
		},
		series: [{
			name: '热量',
			type: 'line',
			smooth: true,
			symbol: 'none',
			sampling: 'average',
			itemStyle: {
				normal: {
					color: '#ffffff',
					lineStyle: {
						color: '#ffffff'
					},
					label: {
						show: true
					}
				}
			},
			smooth: true,
			data: kal_data
		}]
	};

	// 使用刚指定的配置项和数据显示图表。
	myChart1.setOption(option1);
}